﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace luanvanFinal
{
    /// <summary>
    /// Interaction logic for wdRisk.xaml
    /// </summary>
    public partial class wdRisk : Window
    {
        private int idProject;
        public wdRisk()
        {
            InitializeComponent();
        }
        public int IdProject
        {
            get { return idProject; }
            set { idProject = value; }
        }
        int cusCos = 0; int cusFun = 0; int cusCom = 0; int cusGen = 0;
        int cusDoc; int busCos = 0; int busFun = 0; int busGen = 0; int busDoc = 0;
        int busUnd = 0; int busEx = 0; int busDev =0;
        int impGen = 0;
        private void sdd_Click(object sender, RoutedEventArgs e)
        {
            //MessageBox.Show(thu.ToString());
        }

        private void CusCost1_Click(object sender, RoutedEventArgs e)
        {
            cusCos = 1;            
        }

        private void CusCost2_Click(object sender, RoutedEventArgs e)
        {
            cusCos = 2;           
        }

        private void CusCost3_Click(object sender, RoutedEventArgs e)
        {
            cusCos = 3;            
        }

        private void CusCost4_Click(object sender, RoutedEventArgs e)
        {
            cusCos = 4;
        }

        private void CusCost5_Click(object sender, RoutedEventArgs e)
        {
            cusCos = 5;
        }

        private void CusFun1_Click(object sender, RoutedEventArgs e)
        {
            cusFun = 1;
        }

        private void CusFun2_Click(object sender, RoutedEventArgs e)
        {
            cusFun = 2;
        }

        private void CusFun3_Click(object sender, RoutedEventArgs e)
        {
            cusFun = 3;
        }

        private void CusFun4_Click(object sender, RoutedEventArgs e)
        {
            cusFun = 4;
        }
        
        private void CusFun5_Click(object sender, RoutedEventArgs e)
        {
            cusFun = 5;
        }

        private void CusCom1_Click(object sender, RoutedEventArgs e)
        {
            cusCom = 1;
        }

        private void CusCom2_Click(object sender, RoutedEventArgs e)
        {
            cusCom = 2;
        }

        private void CusCom3_Click(object sender, RoutedEventArgs e)
        {
            cusCom = 3;
        }

        private void CusCom4_Click(object sender, RoutedEventArgs e)
        {
            cusCom = 4;
        }

        private void CusCom5_Click(object sender, RoutedEventArgs e)
        {
            cusCom = 5;
        }

        private void CusGen1_Click(object sender, RoutedEventArgs e)
        {
            cusGen = 1;

        }

        private void CusGen2_Click(object sender, RoutedEventArgs e)
        {
            cusGen = 2;
        }

        private void CusGen3_Click(object sender, RoutedEventArgs e)
        {
            cusGen = 3;
        }

        private void CusGen4_Click(object sender, RoutedEventArgs e)
        {
            cusGen = 4;
        }

        private void CusGen5_Click(object sender, RoutedEventArgs e)
        {
            cusGen = 5;
        }

        private void CusDoc1_Click(object sender, RoutedEventArgs e)
        {
            cusDoc = 1;
        }

        private void CusDoc2_Click(object sender, RoutedEventArgs e)
        {
            cusDoc = 2;
        }

        private void CusDoc3_Click(object sender, RoutedEventArgs e)
        {
            cusDoc = 3;
        }

        private void CusDoc4_Click(object sender, RoutedEventArgs e)
        {
            cusDoc = 4;
        }

        private void CusDoc5_Click(object sender, RoutedEventArgs e)
        {
            cusDoc = 5;
        }

        private void BusCost1_Click(object sender, RoutedEventArgs e)
        {
            busCos = 1;
        }

        private void BusCost2_Click(object sender, RoutedEventArgs e)
        {
            busCos = 2;
        }

        private void BusCost3_Click(object sender, RoutedEventArgs e)
        {
            busCos = 3;
        }

        private void BusCost4_Click(object sender, RoutedEventArgs e)
        {
            busCos = 4;
        }

        private void BusCost5_Click(object sender, RoutedEventArgs e)
        {
            busCos = 5;
        }

        private void BusFun1_Click(object sender, RoutedEventArgs e)
        {
            busFun = 1;
        }

        private void BusFun2_Click(object sender, RoutedEventArgs e)
        {
            busFun = 2;
        }

        private void BusFun3_Click(object sender, RoutedEventArgs e)
        {
            busFun = 3;
        }

        private void BusFun4_Click(object sender, RoutedEventArgs e)
        {
            busFun = 4;

        }

        private void BusFun5_Click(object sender, RoutedEventArgs e)
        {
            busFun = 5;
        }

        private void BusGen1_Click(object sender, RoutedEventArgs e)
        {
            busGen = 1;
        }

        private void BusGen2_Click(object sender, RoutedEventArgs e)
        {
            busGen = 2;
        }

        private void BusGen3_Click(object sender, RoutedEventArgs e)
        {
            busGen = 3;
        }

        private void BusGen4_Click(object sender, RoutedEventArgs e)
        {
            busGen = 4;
        }

        private void BusGen5_Click(object sender, RoutedEventArgs e)
        {
            busGen = 5;
        }

        private void BusDoc1_Click(object sender, RoutedEventArgs e)
        {
            busDoc = 1;
        }

        private void BusDoc2_Click(object sender, RoutedEventArgs e)
        {
            busDoc = 2;
        }

        private void BusDoc3_Click(object sender, RoutedEventArgs e)
        {
            busDoc = 3;
        }

        private void BusDoc4_Click(object sender, RoutedEventArgs e)
        {
            busDoc = 4;
        }

        private void BusDoc5_Click(object sender, RoutedEventArgs e)
        {
            busDoc = 5;
        }

        private void BusUnd1_Click(object sender, RoutedEventArgs e)
        {
            busUnd = 1;
        }

        private void BusUnd2_Click(object sender, RoutedEventArgs e)
        {
            busUnd = 2;
        }

        private void BusUnd3_Click(object sender, RoutedEventArgs e)
        {
            busUnd = 3;
        }

        private void BusUnd4_Click(object sender, RoutedEventArgs e)
        {
            busUnd = 4;
        }

        private void BusUnd5_Click(object sender, RoutedEventArgs e)
        {
            busUnd = 5;
        }

        private void BusEx1_Click(object sender, RoutedEventArgs e)
        {
            busEx = 1;
        }

        private void BusEx2_Click(object sender, RoutedEventArgs e)
        {
            busEx = 2;
        }

        

        private void BusEx3_Click(object sender, RoutedEventArgs e)
        {
            busEx = 3;
        }

        private void BusEx4_Click(object sender, RoutedEventArgs e)
        {
            busEx = 4;
        }

        private void BusEx5_Click(object sender, RoutedEventArgs e)
        {
            busEx = 5;
        }

        private void BusDev1_Click(object sender, RoutedEventArgs e)
        {
            busDev = 1;
        }

        private void BusDev2_Click(object sender, RoutedEventArgs e)
        {
            busDev = 2;
        }

        private void BusDev3_Click(object sender, RoutedEventArgs e)
        {
            busDev = 3;
        }

        private void BusDev4_Click(object sender, RoutedEventArgs e)
        {
            busDev = 4;
        }

        private void BusDev5_Click(object sender, RoutedEventArgs e)
        {
            busDev = 5;
        }

        private void ImpGen1_Click(object sender, RoutedEventArgs e)
        {
            impGen = 1;
        }

        private void ImpGen2_Click(object sender, RoutedEventArgs e)
        {
            impGen = 2;
        }

        private void ImpGen3_Click(object sender, RoutedEventArgs e)
        {
            impGen = 3;
        }

        private void ImpGen4_Click(object sender, RoutedEventArgs e)
        {
            impGen = 4;
        }

        private void ImpGen5_Click(object sender, RoutedEventArgs e)
        {
            impGen = 5;
        }
        int impDoc = 0;
        private void ImpDoc1_Click(object sender, RoutedEventArgs e)
        {
            impDoc = 1;
        }

        private void ImpDoc2_Click(object sender, RoutedEventArgs e)
        {
            impDoc = 2;
        }

        private void ImpDoc3_Click(object sender, RoutedEventArgs e)
        {
            impDoc = 3;
        }

        private void ImpDoc4_Click(object sender, RoutedEventArgs e)
        {
            impDoc = 4;
        }

        private void ImpDoc5_Click(object sender, RoutedEventArgs e)
        {
            impDoc = 5;
        }
        int impRes = 0;
        private void ImpRes1_Click(object sender, RoutedEventArgs e)
        {
            impRes = 1;
        }

        private void ImpRes2_Click(object sender, RoutedEventArgs e)
        {
            impRes = 2;
        }

        private void ImpRes3_Click(object sender, RoutedEventArgs e)
        {
            impRes = 3;
        }

        private void ImpRes4_Click(object sender, RoutedEventArgs e)
        {
            impRes = 4;
        }

        private void ImpRes5_Click(object sender, RoutedEventArgs e)
        {
            impRes = 5;
        }
        int impTec = 0;
        private void ImpTec1_Click(object sender, RoutedEventArgs e)
        {
            impTec = 1;
        }

        private void ImpTec2_Click(object sender, RoutedEventArgs e)
        {
            impTec = 2;
        }

        private void ImpTec3_Click(object sender, RoutedEventArgs e)
        {
            impTec = 3;
        }

        private void ImpTec4_Click(object sender, RoutedEventArgs e)
        {
            impTec = 4;
        }

        private void ImpTec5_Click(object sender, RoutedEventArgs e)
        {
            impTec = 5;
        }
        int impEx = 0;
        private void ImpEx1_Click(object sender, RoutedEventArgs e)
        {
            impEx = 1;
        }

        private void ImpEx2_Click(object sender, RoutedEventArgs e)
        {
            impEx = 2;
        }

        private void ImpEx3_Click(object sender, RoutedEventArgs e)
        {
            impEx = 3;
        }

        private void ImpEx4_Click(object sender, RoutedEventArgs e)
        {
            impEx = 4;
        }

        private void ImpEx5_Click(object sender, RoutedEventArgs e)
        {
            impEx = 5;
        }
        int impDev = 0;
        private void ImpDev1_Click(object sender, RoutedEventArgs e)
        {
            impDev = 1;
        }

        private void ImpDev2_Click(object sender, RoutedEventArgs e)
        {
            impDev = 2;
        }

        private void ImpDev3_Click(object sender, RoutedEventArgs e)
        {
            impDev = 3;
        }

        private void ImpDev4_Click(object sender, RoutedEventArgs e)
        {
            impDev = 4;
        }

        private void ImpDev5_Click(object sender, RoutedEventArgs e)
        {
            impDev = 5;
        }
        int quaGen = 0;
        private void QuaGen1_Click(object sender, RoutedEventArgs e)
        {
            quaGen = 1;
        }

        private void QuaGen2_Click(object sender, RoutedEventArgs e)
        {
            quaGen = 2;
        }

        private void QuaGen3_Click(object sender, RoutedEventArgs e)
        {
            quaGen = 3;
        }

        private void QuaGen4_Click(object sender, RoutedEventArgs e)
        {
            quaGen = 4;
        }

        private void QuaGen5_Click(object sender, RoutedEventArgs e)
        {
            quaGen = 5;
        }
        int quaRes = 0;
        private void QuaDoc1_Click(object sender, RoutedEventArgs e)
        {
            quaRes = 1;
        }

        private void QuaDoc2_Click(object sender, RoutedEventArgs e)
        {
            quaRes = 2;
        }

        private void QuaDoc3_Click(object sender, RoutedEventArgs e)
        {
            quaRes = 3;
        }

        private void QuaDoc4_Click(object sender, RoutedEventArgs e)
        {
            quaRes = 4;
        }

        private void QuaDoc5_Click(object sender, RoutedEventArgs e)
        {
            quaRes = 5;
        }
        int quaUnd = 0;
        private void QuaUnd1_Click(object sender, RoutedEventArgs e)
        {
            quaUnd = 1;
        }

        private void QuaUnd2_Click(object sender, RoutedEventArgs e)
        {
            quaUnd = 2;
        }

        private void QuaUnd3_Click(object sender, RoutedEventArgs e)
        {
            quaUnd = 3;
        }

        private void QuaUnd4_Click(object sender, RoutedEventArgs e)
        {
            quaUnd = 4;
        }

        private void QuaUnd5_Click(object sender, RoutedEventArgs e)
        {
            quaUnd = 5;
        }
        int quaEx = 0;
        private void QuaEx1_Click(object sender, RoutedEventArgs e)
        {
            quaEx = 1;
        }

        private void QuaEx2_Click(object sender, RoutedEventArgs e)
        {
            quaEx = 2;
        }

        private void QuaEx3_Click(object sender, RoutedEventArgs e)
        {
            quaEx = 3;
        }

        private void QuaEx4_Click(object sender, RoutedEventArgs e)
        {
            quaEx = 4;
        }

        private void QuaEx5_Click(object sender, RoutedEventArgs e)
        {
            quaEx = 5;
        }
        int quaDev = 0;
        private void QuaDev1_Click(object sender, RoutedEventArgs e)
        {
            quaDev = 1;
        }

        private void QuaDev2_Click(object sender, RoutedEventArgs e)
        {
            quaDev = 2;
        }

        private void QuaDev3_Click(object sender, RoutedEventArgs e)
        {
            quaDev = 3;
        }

        private void QuaDev4_Click(object sender, RoutedEventArgs e)
        {
            quaDev = 4;
        }

        private void QuaDev5_Click(object sender, RoutedEventArgs e)
        {
            quaDev = 5;
        }
        int quaCon = 0;
        private void QuaCon1_Click(object sender, RoutedEventArgs e)
        {
            quaCon = 1;
        }

        private void QuaCon2_Click(object sender, RoutedEventArgs e)
        {
            quaCon = 2;

        }

        private void QuaCon3_Click(object sender, RoutedEventArgs e)
        {
            quaCon = 3;
        }

        private void QuaCon4_Click(object sender, RoutedEventArgs e)
        {
            quaCon = 4;
        }

        private void QuaCon5_Click(object sender, RoutedEventArgs e)
        {
            quaCon = 5;
        }

        private void btnApply_Click(object sender, RoutedEventArgs e)
        {
            int sumCus = Convert.ToInt32(cusCos * 20 * 0.4 + cusFun * 20 * 0.2 + cusCom * 20 * 0.1 + cusGen * 20 * 0.2 + cusDoc * 20 * 0.1);
            int sumBus = Convert.ToInt32(busCos * 20 * 0.4 + busFun * 20 * 0.15 + busGen * 20 * 0.1 + busDoc * 20 * 0.1 + busUnd * 20 * 0.1 + busEx * 20 * 0.1 + busDev * 20 * 0.05);
            int sumImp = Convert.ToInt32 (impGen * 20 * 0.1 + impDoc * 20 * 0.1 + impRes * 20 * 0.3 + impTec * 20 * 0.25 + impEx * 20 * 0.2 + impDev * 20 * 0.05);
            int sumQua = Convert.ToInt32 (quaGen * 20 * 0.2 + quaRes * 20 * 0.1 + quaUnd * 20 * 0.15 + quaEx * 20 * 0.1 + quaDev * 20 * 0.45);
            clsRisk risk = new clsRisk();
            risk.IdProject = this.IdProject;
            risk.CusCos = this.cusCos;
            risk.CusFun = this.cusFun;
            risk.CusCom = this.cusCom;
            risk.CusGen = this.cusGen;
            risk.CusDoc = this.cusDoc;
            risk.BusFun = this.busFun;
            risk.BusGen = this.busGen;
            risk.BusDoc = this.busDoc;
            risk.BusUnd = this.busUnd;
            risk.BusCos = this.busCos;
            risk.BusEx = this.busEx;
            risk.BusDev = this.busDev;
            risk.ImpGen = this.impGen;
            risk.ImpDoc = this.impDoc;
            risk.ImpRes = this.impRes;
            risk.ImpTec = this.impTec;
            risk.ImpEx = this.impEx;
            risk.ImpDev = this.impDev;
            risk.QuaGen = this.quaGen;
            risk.QuaRes = this.quaRes;
            risk.QuaUnd = this.quaUnd;
            risk.QuaEx = this.quaEx;
            risk.QuaDev = this.quaCon;
            risk.SumCos = sumCus;
            risk.SumBus = sumBus;
            risk.SumImp = sumImp;
            risk.SumQua = sumQua;
            //risk.SumCos=(risk.CusCos*0.4+);
            risk.insertRisk();
            MessageBox.Show("Insert Success", "Message", MessageBoxButton.OK, MessageBoxImage.Information);
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {

        }

        
    }
}
